﻿using netDxf;
using netDxf.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TextTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        void AddText(DxfDocument doc, string s, double x, double y, double height)
        {
            MText mtext = new MText(s.Replace("\\", "\\\\"), new Vector2(x, y), height);
            mtext.RectangleWidth = 30000;
            doc.Entities.Add(mtext);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            DxfDocument doc = new DxfDocument(netDxf.Header.DxfVersion.AutoCad2010);

            double y = 0;
            double textH = 200;
            foreach (string line in textBox1.Lines)
            {
                AddText(doc, line, 0, y, textH);
                y += textH * 1.5;
            }
            //doc.DrawingVariables.AcadVer = netDxf.Header.DxfVersion.AutoCad2010;
            Console.WriteLine(doc.DrawingVariables.AcadVer);

            doc.Save("text.dxf");
        }
    }
}
